import { withRouter } from 'react-router-dom'
import { Icon } from 'react-vant';
export default withRouter((routerProps) => {
     
  const handleLogin = () => {
    routerProps.history.replace('/login')
  }
  const handleRegister = () => {
    routerProps.history.replace('/register')
  }
  const handleSearch = () => {
    routerProps.history.push('/search')
  }
  return (
    <div className='header_warp'>
      <div className='input_box' >
        <Icon name="search" size={30} />
        <input type="text" placeholder='请输入相关内容' onClick={handleSearch} />
      </div>
      <div className='loginState'>
        {
          // <span onClick={handleLogin}>登录</span>/<span onClick={handleRegister}>注册</span>
          window.localStorage.getItem('isLogin') === "true" ? <b>已登录</b> : <div><span onClick={handleLogin}>登录</span> / <span onClick={handleRegister}>注册</span></div>
        }
      </div>
    </div>
  )
});